package com.bwie.controller;

import com.bwie.pojo.TbOrder;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.Result;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/shop/order")
public class OrderController {
    @Autowired
    TbOrderService tbOrderService;

    /**
     * 订单列表
     *
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getOrderList")
    public Result getOrderList(@RequestBody PageInfoVo pageInfoVo) {
        return tbOrderService.getOrderList(pageInfoVo);
    }


    /**
     * 信息列表
     *
     * @return
     */
    @PostMapping("/getProdInfo")
    public Result getProdInfo() {
        return tbOrderService.getProdInfo();
    }

    /**
     * 添加订单
     *
     * @return
     */
    @PostMapping("/addProdInfo")
    public Result addProdInfo(@RequestBody List<TbProdInfo> infoList) {
        return tbOrderService.addProdInfo(infoList);
    }


    /**
     * 导出
     */
    @GetMapping("/exportOrderList/{userId}")
    public void exportOrderList(@PathVariable("userId") Integer userId) {
        tbOrderService.exportOrderList(userId);
    }


}
